package com.jfzt.utils;

import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 * @author: shunpeng.hu
 * @date: 2024/1/24 10:25
 */
public class HashRandomUtils {

    public static byte[] hashSaltRandom(String msg) throws UnsupportedEncodingException {
        // 创建一个MessageDigest实例:
        MessageDigest md = null;
        try {
            md = MessageDigest.getInstance("MD5");
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
        // 反复调用update输入数据:
        md.update("Hello".getBytes("UTF-8"));
        md.update("World".getBytes("UTF-8"));
        byte[] result = md.digest(); // 16 bytes: 68e109f0f40ca72a15e05cc22786f8e6
        return result;
    }
}
